Sellercost.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. namespace app\api\controller;
  3. use think\facade\Lang;
  4. /**
  5. * ============================================================================
  6. *
  7. * ============================================================================
  8. * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
  9. * 网站地址: https://www.valimart.net/
  10. * ----------------------------------------------------------------------------
  11. *
  12. * ============================================================================
  13. * 店铺花费控制器
  14. */
  15. class Sellercost extends MobileSeller {
  16. public function initialize() {
  17. parent::initialize();
  18. }
  19. /**
  20. * @api {POST} api/Sellercost/cost_list 店铺花费列表
  21. * @apiVersion 1.0.0
  22. * @apiGroup Sellercost
  23. *
  24. * @apiHeader {String} X-DS-KEY 卖家授权token
  25. *
  26. * @apiParam {String} storecost_remark 日志内容
  27. * @apiParam {String} add_time_from 开始时间 YYYY-MM-DD
  28. * @apiParam {String} add_time_to 结束时间 YYYY-MM-DD
  29. * @apiParam {Int} page 页码
  30. * @apiParam {Int} pagesize 每页显示数量
  31. *
  32. * @apiSuccess {String} code 返回码,10000为成功
  33. * @apiSuccess {String} message 返回消息
  34. * @apiSuccess {Object} result 返回数据
  35. * @apiSuccess {Object[]} result.cost_list 花费列表 (返回字段参考storecost表)
  36. * @apiSuccess {Int} result.page_total 总页数
  37. * @apiSuccess {Boolean} result.hasmore 是否有更多 true是false否
  38. */
  39. public function cost_list() {
  40. $storecost_model = model('storecost');
  41. $condition = array();
  42. $condition[] = array('storecost_store_id', '=', $this->store_info['store_id']);
  43. $storecost_remark = input('param.storecost_remark');
  44. if (!empty($storecost_remark)) {
  45. $condition[] = array('storecost_remark', 'like', '%' . $storecost_remark . '%');
  46. }
  47. $add_time_from = input('param.add_time_from');
  48. $add_time_to = input('param.add_time_to');
  49. if (!empty($add_time_from) && !empty($add_time_to)) {
  50. $condition[] = array('storecost_time', 'between', array(strtotime($add_time_from), strtotime($add_time_to)));
  51. }
  52. $cost_list = $storecost_model->getStorecostList($condition, 10, 'storecost_id desc');
  53. $result = array_merge(array('cost_list' => $cost_list), mobile_page($storecost_model->page_info));
  54. ds_json_encode(10000, lang('ds_common_op_succ'), $result);
  55. }
  56. }