yspay_merchant.php 11 KB

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