yspay_merchant.php 9.6 KB

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