order.php 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592
  1. <?php
  2. $type = array
  3. (
  4. //1 => '购买电子刊',
  5. //2 => '兑换电子刊',
  6. 3 => '购买兑换码',
  7. //4 => '使用通用兑换码',
  8. );
  9. # 系统
  10. $system = array
  11. (
  12. 1 => '小程序',
  13. 2 => 'H5',
  14. 3 => 'ios',
  15. 4 => '安卓',
  16. );
  17. # 渠道
  18. $source = function()
  19. {
  20. return Dever::db('source/info')->state();
  21. };
  22. $status = array
  23. (
  24. 1 => '待支付',
  25. 2 => '已支付',
  26. 3 => '支付失败',
  27. //4 => '申请退款',
  28. 5 => '已退款',
  29. );
  30. $product = function()
  31. {
  32. return Dever::db('journal/info')->state();
  33. };
  34. $buy = function()
  35. {
  36. return Dever::db('journal/buy_num')->state();
  37. };
  38. # 获取电子刊分类权限
  39. $auth = Dever::tops();
  40. $cate = function() use ($auth)
  41. {
  42. $array = array();
  43. if ($auth) {
  44. $info = Dever::db('journal/cate')->getIds(array('ids' => $auth));
  45. } else {
  46. $info = Dever::db('journal/cate')->state();
  47. }
  48. if($info)
  49. {
  50. $array += $info;
  51. }
  52. return $array;
  53. };
  54. $seller = function()
  55. {
  56. return Dever::db('code/seller')->state();
  57. };
  58. return array
  59. (
  60. # 表名
  61. 'name' => 'order',
  62. # 显示给用户看的名称
  63. 'lang' => '订单管理',
  64. 'order' => 1,
  65. 'menu' => 'journal',
  66. 'end' => array
  67. (
  68. 'update' => 'act/lib/pay.order',
  69. ),
  70. # 数据结构
  71. 'struct' => array
  72. (
  73. 'id' => array
  74. (
  75. 'type' => 'int-11',
  76. 'name' => 'ID',
  77. 'default' => '',
  78. 'desc' => '',
  79. 'match' => 'is_numeric',
  80. 'search' => 'order',
  81. //'list' => true,
  82. ),
  83. 'order_id' => array
  84. (
  85. 'type' => 'varchar-100',
  86. 'name' => '支付订单ID/订单表ID',
  87. 'default' => '',
  88. 'desc' => '付款订单id',
  89. 'match' => 'is_string',
  90. 'update' => 'text',
  91. 'search' => 'fulltext',
  92. //'list' => true,
  93. 'list' => 'Dever::load("act/order.getOrderId", {id})',
  94. ),
  95. 'cate_journal' => array
  96. (
  97. 'name' => '电子刊',
  98. 'default' => '',
  99. 'desc' => '电子刊',
  100. 'search' => 'linkage',
  101. 'search_col' => 'cate_id,product_id',
  102. 'option' => Dever::url('lib/manage.search_cate_journal', 'journal'),
  103. ),
  104. 'cate_id' => array
  105. (
  106. 'type' => 'int-11',
  107. 'name' => '所属刊物',
  108. 'default' => '1',
  109. 'desc' => '所属刊物',
  110. 'match' => 'is_numeric',
  111. 'update' => 'select',
  112. 'option' => $cate,
  113. //'search' => 'select',
  114. 'list' => true,
  115. ),
  116. 'name' => array
  117. (
  118. 'type' => 'varchar-80',
  119. 'name' => '订单名称',
  120. 'default' => '',
  121. 'desc' => '订单名称',
  122. 'match' => 'is_string',
  123. 'update' => 'text',
  124. 'search' => 'fulltext',
  125. 'list_name' => '订单信息',
  126. 'list' => 'Dever::load("journal/lib/manage.showOrderUserV1", "{id}")',
  127. ),
  128. 'uid' => array
  129. (
  130. 'type' => 'int-11',
  131. 'name' => '用户名',
  132. 'default' => '',
  133. 'desc' => '用户id',
  134. 'match' => 'is_numeric',
  135. 'search' => array
  136. (
  137. 'api' => 'passport/user-all',
  138. 'col' => 'username',
  139. 'result' => 'id',
  140. ),
  141. 'update' => 'text',
  142. ),
  143. 'source_uid' => array
  144. (
  145. 'type' => 'int-11',
  146. 'name' => '邀请人',
  147. 'default' => '',
  148. 'desc' => '邀请人',
  149. 'match' => 'is_numeric',
  150. 'update' => 'text',
  151. ),
  152. 'note' => array
  153. (
  154. 'type' => 'tinyint-1',
  155. 'name' => '是否发送状态提醒-1未发送,2已发送',
  156. 'default' => '1',
  157. 'desc' => '请选择状态',
  158. 'match' => 'is_numeric',
  159. ),
  160. 'product_id' => array
  161. (
  162. 'type' => 'int-11',
  163. 'name' => '电子刊',
  164. 'default' => '',
  165. 'desc' => '电子刊',
  166. 'match' => 'is_numeric',
  167. 'update' => 'select',
  168. 'option' => $product,
  169. //'search' => 'select',
  170. //'list' => true,
  171. ),
  172. 'star_id' => array
  173. (
  174. 'type' => 'int-11',
  175. 'name' => '明星',
  176. 'default' => '',
  177. 'desc' => '明星',
  178. 'match' => 'is_numeric',
  179. 'update' => 'select',
  180. //'search' => 'select',
  181. //'list' => true,
  182. ),
  183. 'buy_id' => array
  184. (
  185. 'type' => 'int-11',
  186. 'name' => '购买本数-仅做记录',
  187. 'default' => '',
  188. 'desc' => '购买本数',
  189. 'match' => 'is_numeric',
  190. 'update' => 'select',
  191. 'option' => $buy,
  192. //'search' => 'select',
  193. //'list' => true,
  194. ),
  195. 'buy_num' => array
  196. (
  197. 'type' => 'int-11',
  198. 'name' => '购买本数-以此为准',
  199. 'default' => '',
  200. 'desc' => '购买本数',
  201. 'match' => 'is_numeric',
  202. //'search' => 'select',
  203. //'list' => true,
  204. ),
  205. 'type' => array
  206. (
  207. 'type' => 'int-11',
  208. 'name' => '支付方式',
  209. 'default' => '1',
  210. 'desc' => '支付方式',
  211. 'match' => 'is_numeric',
  212. 'option' => $type,
  213. 'search' => 'select',
  214. 'update' => 'radio',
  215. //'list' => true,
  216. 'control' => 'type',
  217. ),
  218. 'system' => array
  219. (
  220. 'type' => 'int-11',
  221. 'name' => '系统',
  222. 'default' => '1',
  223. 'desc' => '系统',
  224. 'match' => 'is_numeric',
  225. 'option' => $system,
  226. 'search' => 'select',
  227. 'update' => 'radio',
  228. 'list' => true,
  229. ),
  230. 'seller_id' => array
  231. (
  232. 'type' => 'int-11',
  233. 'name' => '销售商',
  234. 'default' => '1',
  235. 'desc' => '销售商',
  236. 'match' => 'is_numeric',
  237. 'update' => 'select',
  238. 'option' => $seller,
  239. 'search' => 'select',
  240. //'list' => true,
  241. ),
  242. 'notice' => array
  243. (
  244. 'type' => 'int-11',
  245. 'name' => '模板消息提醒次数',
  246. 'default' => '0',
  247. 'desc' => '模板消息提醒次数',
  248. 'match' => 'is_numeric',
  249. ),
  250. 'cash' => array
  251. (
  252. 'type' => 'varchar-50',
  253. 'name' => '支付金额',
  254. 'default' => '',
  255. 'desc' => '支付金额',
  256. 'match' => 'option',
  257. 'update' => 'text',
  258. //'list' => true,
  259. 'show' => 'type=1',
  260. ),
  261. 'code' => array
  262. (
  263. 'type' => 'varchar-50',
  264. 'name' => '使用的兑换码',
  265. 'default' => '',
  266. 'desc' => '使用的兑换码',
  267. 'match' => 'option',
  268. 'update' => 'text',
  269. //'list' => true,
  270. 'show' => 'type=2',
  271. ),
  272. 'status' => array
  273. (
  274. 'type' => 'tinyint-1',
  275. 'name' => '订单状态',
  276. 'default' => '1',
  277. 'desc' => '请选择订单状态',
  278. 'match' => 'is_numeric',
  279. 'option' => $status,
  280. 'search' => 'select',
  281. 'update' => 'radio',
  282. 'list' => 'Dever::load("journal/lib/manage.showOrderStatusV1", "{id}")',
  283. 'control' => 'status',
  284. ),
  285. 'tk_pic' => array
  286. (
  287. 'type' => 'varchar-150',
  288. 'name' => '退款截图',
  289. 'default' => '',
  290. 'desc' => '退款截图',
  291. 'match' => 'is_string',
  292. 'update' => 'image',
  293. 'key' => 1
  294. ),
  295. 'tk_time' => array
  296. (
  297. 'type' => 'int-11',
  298. 'name' => '退款时间',
  299. 'default' => '',
  300. 'desc' => '退款时间',
  301. 'match' => 'option',
  302. //'list' => true,
  303. //'update' => 'date',
  304. 'callback' => 'maketime',
  305. 'show' => 'status=5',
  306. ),
  307. 'tk_admin' => array
  308. (
  309. 'type' => 'int-11',
  310. 'name' => '退款审核人',
  311. 'default' => '1',
  312. 'desc' => '退款审核人',
  313. 'match' => 'option',
  314. //'list' => true,
  315. 'show' => 'status=5',
  316. ),
  317. 'tk_desc' => array
  318. (
  319. 'type' => 'varchar-300',
  320. 'name' => '退款备注',
  321. 'default' => '',
  322. 'desc' => '退款备注',
  323. 'match' => 'option',
  324. 'update' => 'textarea',
  325. //'show' => 'status=5',
  326. ),
  327. 'state' => array
  328. (
  329. 'type' => 'tinyint-1',
  330. 'name' => '状态',
  331. 'default' => '1',
  332. 'desc' => '请选择状态',
  333. 'match' => 'is_numeric',
  334. ),
  335. 'cdate' => array
  336. (
  337. 'type' => 'int-11',
  338. 'name' => '下单时间',
  339. 'match' => array('is_numeric', time()),
  340. 'desc' => '',
  341. # 只有insert时才生效
  342. 'insert' => true,
  343. 'search' => 'date',
  344. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  345. //'list' => 'Dever::load("service/lib/manage.showOrderTime", "{id}")',
  346. ),
  347. 'info' => array
  348. (
  349. 'type' => 'varchar-300',
  350. 'name' => '备注',
  351. 'default' => '',
  352. 'desc' => '备注',
  353. 'match' => 'option',
  354. 'update' => 'textarea',
  355. //'show' => 'status=5'
  356. //'list' => '"{info}" ? "{info}" : "双击添加备注"',
  357. //'edit' => true,
  358. ),
  359. 'mobile' => array
  360. (
  361. 'type' => 'varchar-300',
  362. 'name' => '手机号',
  363. 'default' => '',
  364. 'desc' => '手机号',
  365. 'match' => 'option',
  366. //'show' => 'status=5'
  367. 'search' => array
  368. (
  369. 'api' => 'passport/user-all',//接口地址,最好是获取多条数据的地址
  370. 'col' => 'mobile',//要查询的字段
  371. 'result' => 'id',//返回的字段
  372. 'search' => 'uid',//本表的字段,默认为当前的字段
  373. ),
  374. ),
  375. ),
  376. 'top' => Dever::config('base')->top,
  377. # 增加这个,为了给当前的list增加一个option
  378. 'top_option' => array
  379. (
  380. 'value' => $auth,
  381. 'col' => 'cate_id',
  382. ),
  383. 'manage' => array
  384. (
  385. 'delete' => false,
  386. 'edit' => false,
  387. 'insert' => false,
  388. 'button' => array
  389. (
  390. //'导出订单' => array('location', 'journal/lib/manage.out'),
  391. ),
  392. 'list_button' => array(
  393. 'edit' => array('退款', 'status,tk_time,tk_pic,tk_desc,tk_admin', '{status} >= 2 && ({type} == 1 || {type} == 3)'),
  394. //'delete' => array('删除', '', '{status} == 1'),
  395. ),
  396. ),
  397. 'request' => array
  398. (
  399. 'getAll' => array
  400. (
  401. # 匹配的正则或函数 选填项
  402. 'option' => array
  403. (
  404. 'type' => 'yes',
  405. 'create_uid' => 'yes',
  406. 'status' => array('1', '!='),
  407. 'uid' => 'yes',
  408. 'state' => 1,
  409. ),
  410. 'type' => 'all',
  411. 'order' => array('cdate' => 'desc'),
  412. 'page' => array(10, 'list'),
  413. 'col' => '*',
  414. ),
  415. 'getYes' => array
  416. (
  417. # 匹配的正则或函数 选填项
  418. 'option' => array
  419. (
  420. 'product_id' => 'yes',
  421. 'state' => 1,
  422. ),
  423. 'type' => 'all',
  424. 'order' => array('cdate' => 'desc'),
  425. 'col' => '*',
  426. ),
  427. # 获取提交订单超过12个小时
  428. 'getDataByTime' => array
  429. (
  430. # 匹配的正则或函数 选填项
  431. 'option' => array
  432. (
  433. 'cdate' => array('yes', '>='),
  434. 'notice' => 'yes',
  435. 'note' => 'yes',
  436. 'type' => array('yes', 'in'),
  437. 'state' => 1,
  438. ),
  439. 'type' => 'all',
  440. 'order' => array('cdate' => 'desc'),
  441. 'col' => '*',
  442. ),
  443. # 获取没有兑换码的订单
  444. 'getUnCode' => array
  445. (
  446. # 匹配的正则或函数 选填项
  447. 'option' => array
  448. (
  449. 'code' => array('yes', '='),
  450. 'status' => 'yes',
  451. 'type' => 'yes',
  452. 'state' => 1,
  453. ),
  454. 'type' => 'all',
  455. 'order' => array('id' => 'desc'),
  456. 'limit' => '0,100',
  457. 'col' => '*',
  458. ),
  459. # 获取1,2
  460. 'getBuy' => array
  461. (
  462. # 匹配的正则或函数 选填项
  463. 'option' => array
  464. (
  465. 'status' => 'yes',
  466. 'type' => array('yes', 'in'),
  467. 'product_id' => 'yes',
  468. 'order_id' => 'yes',
  469. 'uid' => 'yes',
  470. 'state' => 1,
  471. ),
  472. 'type' => 'all',
  473. 'order' => array('id' => 'desc'),
  474. 'col' => '*',
  475. ),
  476. 'getMyAll' => array
  477. (
  478. # 匹配的正则或函数 选填项
  479. 'option' => array
  480. (
  481. 'type' => 'yes',
  482. 'uid' => 'yes',
  483. 'status' => 'yes',
  484. 'cate_id' => 'yes',
  485. 'state' => 1,
  486. ),
  487. 'type' => 'all',
  488. 'order' => array('id' => 'desc'),
  489. 'page' => array(10, 'list'),
  490. 'col' => 'id,order_id,name,buy_num,cdate,cash,product_id,buy_id',
  491. ),
  492. # 删除未支付订单
  493. 'drop' => array
  494. (
  495. # 匹配的正则或函数 选填项
  496. 'where' => array
  497. (
  498. 'time' => array('yes-cdate', '<='),
  499. 'status' => 1,
  500. 'state' => 1,
  501. ),
  502. 'type' => 'delete',
  503. 'col' => 'id,order_id',
  504. ),
  505. # 获取数据
  506. 'getAllByDate' => array
  507. (
  508. # 匹配的正则或函数 选填项
  509. 'where' => array
  510. (
  511. 'time' => array('yes-cdate', '<='),
  512. ),
  513. 'type' => 'all',
  514. 'col' => 'id,order_id',
  515. ),
  516. 'getNumByJournal' => array
  517. (
  518. # 匹配的正则或函数 选填项
  519. 'option' => array
  520. (
  521. 'product_id' => 'yes',
  522. 'state' => 1,
  523. ),
  524. 'type' => 'one',
  525. 'col' => 'sum(buy_num) as buy_num',
  526. ),
  527. 'getNumByStar' => array
  528. (
  529. # 匹配的正则或函数 选填项
  530. 'option' => array
  531. (
  532. 'star_id' => 'yes',
  533. 'product_id' => 'yes',
  534. 'state' => 1,
  535. ),
  536. 'type' => 'one',
  537. 'col' => 'sum(buy_num) as buy_num',
  538. ),
  539. ),
  540. );