yspay_merchant.php 9.3 KB

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