Sellerlog.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. namespace app\api\controller;
  3. use think\facade\Lang;
  4. /**
  5. *
  6. *
  7. * ----------------------------------------------------------------------------
  8. *
  9. * 卖家日志控制器
  10. */
  11. class Sellerlog extends MobileSeller
  12. {
  13. public function initialize()
  14. {
  15. parent::initialize();
  16. }
  17. /**
  18. * @api {POST} api/Sellerlog/log_list 店铺日志列表
  19. * @apiVersion 1.0.0
  20. * @apiGroup Sellerlog
  21. *
  22. * @apiHeader {String} X-DS-KEY 卖家授权token
  23. *
  24. * @apiParam {Int} cate_id 分类ID
  25. * @apiParam {String} seller_name 卖家账号
  26. * @apiParam {String} log_content 日志内容
  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.log_list 日志列表 (返回字段参考sellerlog表)
  36. * @apiSuccess {Int} result.page_total 总页数
  37. * @apiSuccess {Boolean} result.hasmore 是否有更多 true是false否
  38. */
  39. public function log_list()
  40. {
  41. $sellerlog_model = model('sellerlog');
  42. $condition = array();
  43. $condition[] = array('sellerlog_store_id', '=', $this->store_info['store_id']);
  44. $seller_name = input('param.seller_name');
  45. $log_content = input('param.log_content');
  46. $add_time_from = input('param.add_time_from');
  47. $add_time_to = input('param.add_time_to');
  48. if (!empty($seller_name)) {
  49. $condition[] = array('sellerlog_seller_name', 'like', '%' . input('param.seller_name') . '%');
  50. }
  51. if (!empty($log_content)) {
  52. $condition[] = array('sellerlog_content', 'like', '%' . $log_content . '%');
  53. }
  54. if (!empty($add_time_from) || $add_time_to) {
  55. $condition[] = array('sellerlog_time', 'between', [strtotime($add_time_from), strtotime($add_time_to)]);
  56. }
  57. $log_list = $sellerlog_model->getSellerlogList($condition, 10, 'sellerlog_id desc');
  58. $result = array_merge(array('log_list' => $log_list), mobile_page($sellerlog_model->page_info));
  59. ds_json_encode(10000, lang('ds_common_op_succ'), $result);
  60. }
  61. }