yspay_merchant.php 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  1. <?php
  2. $type = array
  3. (
  4. 1 => '正常商户',
  5. 2 => '平台商户',
  6. );
  7. $status = array
  8. (
  9. 1 => '已签约',
  10. 2 => '未签约',
  11. );
  12. $project = function()
  13. {
  14. return Dever::db('pay/yspay_project')->state();
  15. };
  16. $account_id = Dever::input('search_option_account_id');
  17. $yspay_type = 1;
  18. if ($account_id) {
  19. $yspay = Dever::db('pay/yspay')->find(array('account_id' => $account_id));
  20. $yspay_type = $yspay['type'];
  21. }
  22. $set = Dever::input('set');
  23. $list_button = array
  24. (
  25. 'edit' => array('编辑'),
  26. 'add' => array('签约资料', '"yspay_sign&search_option_merchant_id={id}&search_option_account_id={account_id}&where_id={id}&oper_table=account&oper_save_table=yspay_merchant"', '{status} == 2'),
  27. 'oper' => array('签约提审', 'pay/yspay/sign.handle?sign_id={id}', '"{pay/yspay_sign-one#step}" == -1 && {status} == 2'),
  28. 'fast' => array('签约打款', '"yspay_sign&where_id={id}&col=cash"', '"{pay/yspay_sign-one#step}" == 2 && {status} == 2'),
  29. 'copy' => array('签约合同', 'pay/yspay/sign.getAgreement?sign_id={id}', '"{pay/yspay_sign-one#step}" == 4 && {status} == 2'),
  30. );
  31. if ($yspay_type == 2) {
  32. $list_button['list3'] = array('资金流水', '"yspay_cash&search_option_merchant_id={id}&search_option_account_id={account_id}&oper_table=yspay_merchant&top_table=account"', '{status} == 1');
  33. }
  34. if ($yspay_type == 1) {
  35. $list_button['list2'] = array('提现管理', '"yspay_tixian&search_option_merchant_id={id}&search_option_account_id={account_id}&oper_table=yspay_merchant&top_table=account"', '{status} == 1');
  36. }
  37. $list_button['list1'] = array('签约日志', '"yspay_sign_log&search_option_account_id={account_id}&search_option_merchant_id={id}&oper_table=yspay_merchant&top_table=account"');
  38. return array
  39. (
  40. # 表名
  41. 'name' => 'yspay_merchant',
  42. # 显示给用户看的名称
  43. 'lang' => '银联商户列表',
  44. # 后台菜单排序
  45. 'order' => -100,
  46. //'check' => 'account_id,project_id,mid',
  47. 'menu' => false,
  48. # 数据结构
  49. 'struct' => array
  50. (
  51. 'id' => array
  52. (
  53. 'type' => 'int-11',
  54. 'name' => 'ID',
  55. 'default' => '',
  56. 'desc' => '',
  57. 'match' => 'is_numeric',
  58. 'search' => 'order',
  59. //'list' => true,
  60. 'order' => 'desc',
  61. ),
  62. 'account_id' => array
  63. (
  64. 'type' => 'int-11',
  65. 'name' => '账户id',
  66. 'default' => '',
  67. 'desc' => '账户id',
  68. 'match' => 'option',
  69. 'update' => 'hidden',
  70. 'value' => $account_id,
  71. ),
  72. 'name' => array
  73. (
  74. 'type' => 'varchar-300',
  75. 'name' => '商户名称',
  76. 'default' => '',
  77. 'desc' => '商户名称',
  78. 'match' => 'is_string',
  79. 'update' => $set ? false : 'text',
  80. 'search' => 'fulltext',
  81. 'list' => true,
  82. ),
  83. 'type' => array
  84. (
  85. 'type' => 'int-11',
  86. 'name' => '商户类型-平台商户将自动收取支付时未配置正常商户的金额,有多个平台商户时将自动随机抽取,平台商户不会分账',
  87. 'default' => '1',
  88. 'desc' => '商户类型',
  89. 'match' => 'option',
  90. 'search' => 'select',
  91. 'update' => $set ? false : 'radio',
  92. 'option' => $type,
  93. 'list' => true,
  94. 'control' => 'type',
  95. ),
  96. 'project_id' => array
  97. (
  98. 'type' => 'int-11',
  99. 'name' => '所属项目',
  100. 'default' => '',
  101. 'desc' => '所属项目',
  102. 'match' => 'option',
  103. 'search' => 'select',
  104. 'update' => $set ? false : 'radio',
  105. 'control_url' => 'pay/yspay/merchant.selectRelate',
  106. 'option' => $project,
  107. //'list' => true,
  108. 'show' => 'type=1',
  109. ),
  110. 'relate_id' => array
  111. (
  112. 'type' => 'int-11',
  113. 'name' => '关联数据',
  114. 'default' => '-1',
  115. 'desc' => '关联数据',
  116. 'match' => 'option',
  117. 'update' => $set ? false : 'select',
  118. 'show' => 'type=1',
  119. ),
  120. 'mid' => array
  121. (
  122. 'type' => 'varchar-200',
  123. 'name' => '商户号',
  124. 'default' => '',
  125. 'desc' => '商户号',
  126. 'match' => 'option',
  127. 'search' => 'fulltext',
  128. 'update' => 'text',
  129. 'list' => true,
  130. ),
  131. 'merno' => array
  132. (
  133. 'type' => 'varchar-200',
  134. 'name' => '企业用户号-清分时使用',
  135. 'default' => '',
  136. 'desc' => '企业用户号',
  137. 'match' => 'option',
  138. 'update' => 'text',
  139. ),
  140. 'cash_per' => array
  141. (
  142. 'type' => 'int-11',
  143. 'name' => '平台分账百分比-如输入10,就是从总支付金额中分账10%,输入0则使用默认分账百分比,输入负数则不进行百分比分账',
  144. 'default' => '',
  145. 'desc' => '平台分账百分比',
  146. 'match' => 'option',
  147. //'update' => 'text',
  148. ),
  149. 'cash' => array
  150. (
  151. 'type' => 'int-11',
  152. 'name' => '资金总额',
  153. 'default' => '0',
  154. 'desc' => '资金总额',
  155. 'match' => 'option',
  156. //'update' => 'text',
  157. 'list_name' => '分账总额 / 划付总额 / 提现总额',
  158. 'list' => $yspay_type == 1 ? false : 'Dever::number({fz_cash}/100, 2) . " / " . Dever::number({hf_cash}/100, 2) . " / " . Dever::number({hf_tx_cash}/100, 2)',
  159. ),
  160. 'hf_cash' => array
  161. (
  162. 'type' => 'int-11',
  163. 'name' => '划付总额-划付就是提现到商户自己账户的意思',
  164. 'default' => '0',
  165. 'desc' => '划付总额',
  166. 'match' => 'option',
  167. //'update' => 'text',
  168. //'list' => 'Dever::number({hf_cash}/100, 2)',
  169. ),
  170. 'hf_tx_cash' => array
  171. (
  172. 'type' => 'int-11',
  173. 'name' => '划付提现总额',
  174. 'default' => '0',
  175. 'desc' => '划付提现总额',
  176. 'match' => 'option',
  177. //'update' => 'text',
  178. //'list' => 'Dever::number({hf_cash}/100, 2)',
  179. ),
  180. 'fz_cash' => array
  181. (
  182. 'type' => 'int-11',
  183. 'name' => '分账总额',
  184. 'default' => '0',
  185. 'desc' => '分账总额',
  186. 'match' => 'option',
  187. //'update' => 'text',
  188. //'list' => 'Dever::number({fz_cash}/100, 2)',
  189. ),
  190. 'yue' => array
  191. (
  192. 'type' => 'int-11',
  193. 'name' => '账户余额',
  194. 'default' => '0',
  195. 'desc' => '账户余额',
  196. 'match' => 'option',
  197. //'update' => 'text',
  198. 'list_name' => '账户余额 / 提现总额',
  199. 'list' => $yspay_type == 2 ? false : 'Dever::number({yue}/100, 2) . " / " . Dever::number({tx_cash}/100, 2)',
  200. ),
  201. 'tx_cash' => array
  202. (
  203. 'type' => 'int-11',
  204. 'name' => '提现总额',
  205. 'default' => '0',
  206. 'desc' => '划付总额',
  207. 'match' => 'option',
  208. //'update' => 'text',
  209. //'list' => 'Dever::number({tx_cash}/100, 2)',
  210. ),
  211. 'pay/yspay_sign-one#step'=> array
  212. (
  213. 'name' => '当前状态',
  214. 'default' => '',
  215. 'desc' => '当前状态',
  216. 'match' => 'option',
  217. # 读取另外表的关联方式
  218. 'sync' => array('merchant_id' => 'id'),
  219. ),
  220. 'status' => array
  221. (
  222. 'type' => 'tinyint-11',
  223. 'name' => '状态',
  224. 'default' => '2',
  225. 'desc' => '状态',
  226. 'match' => 'option',
  227. 'option' => $status,
  228. 'update' => 'radio',
  229. 'search' => 'select',
  230. //'list' => true,
  231. ),
  232. 'state' => array
  233. (
  234. 'type' => 'tinyint-1',
  235. 'name' => '状态',
  236. 'default' => '1',
  237. 'desc' => '请选择状态',
  238. 'match' => 'is_numeric',
  239. 'list_name' => '签约进度',
  240. 'list' => 'Dever::load("pay/yspay/sign.getLog", {id}, {status})',
  241. ),
  242. 'cdate' => array
  243. (
  244. 'type' => 'int-11',
  245. 'name' => '录入时间',
  246. 'match' => array('is_numeric', time()),
  247. 'desc' => '',
  248. # 只有insert时才生效
  249. 'insert' => true,
  250. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  251. ),
  252. ),
  253. 'manage' => array
  254. (
  255. 'insert' => false,
  256. 'edit' => false,
  257. # 自定义快捷新增和编辑
  258. 'button' => array
  259. (
  260. '新增' => array('fast'),
  261. ),
  262. 'list_button' => $list_button,
  263. ),
  264. 'request' => array
  265. (
  266. 'tx_inc' => array
  267. (
  268. 'type' => 'update',
  269. 'where' => array
  270. (
  271. 'id' => 'yes',
  272. ),
  273. 'set' => array
  274. (
  275. 'tx_cash' => array('yes', '+='),
  276. ),
  277. ),
  278. 'dec' => array
  279. (
  280. 'type' => 'update',
  281. 'where' => array
  282. (
  283. 'id' => 'yes',
  284. ),
  285. 'set' => array
  286. (
  287. 'yue' => array('yes', '-='),
  288. ),
  289. ),
  290. 'updateTxCash' => array
  291. (
  292. 'type' => 'update',
  293. 'where' => array
  294. (
  295. 'id' => 'yes',
  296. ),
  297. 'set' => array
  298. (
  299. 'hf_tx_cash' => array('yes', '+='),
  300. ),
  301. ),
  302. )
  303. );