Sellerlog.php 2.6 KB

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