yspay_merchant.php 9.6 KB

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