1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- <?php
- namespace app\api\controller;
- use think\facade\Lang;
- /**
-
- *
-
- *
- * ----------------------------------------------------------------------------
- *
-
- * 咨询控制器
- */
- class Memberconsult extends MobileMember
- {
- public function initialize()
- {
- parent::initialize(); // TODO: Change the autogenerated stub
- Lang::load(base_path() . 'home/lang/' . config('lang.default_lang') . '/sellerconsult.lang.php');
- }
- /**
- * @api {POST} api/Memberconsult/index 查询买家商品咨询
- * @apiVersion 1.0.0
- * @apiGroup Memberconsult
- *
- * @apiHeader {String} X-DS-KEY 用户授权token
- *
- * @apiParam {String} type 类型 to_reply待回复 replied已回复
- * @apiParam {Int} per_page 每页显示数量
- * @apiParam {Int} page 当前页数
- *
- * @apiSuccess {String} code 返回码,10000为成功
- * @apiSuccess {String} message 返回消息
- * @apiSuccess {Object} result 返回数据
- * @apiSuccess {Object[]} result.consult_list 咨询列表
- * @apiSuccess {Int} result.consult_list.consult_addtime 咨询时间,Unix时间戳
- * @apiSuccess {Int} result.consult_list.consult_content 咨询内容
- * @apiSuccess {Int} result.consult_list.consult_id 咨询ID
- * @apiSuccess {Int} result.consult_list.consult_isanonymous 是否匿名,0否1是
- * @apiSuccess {Int} result.consult_list.consult_reply 回复内容
- * @apiSuccess {Int} result.consult_list.consult_replytime 回复时间
- * @apiSuccess {Int} result.consult_list.consulttype_id 咨询类型ID
- * @apiSuccess {Int} result.consult_list.goods_id 商品ID
- * @apiSuccess {Int} result.consult_list.goods_name 商品名称
- * @apiSuccess {Int} result.consult_list.member_id 用户ID
- * @apiSuccess {Int} result.consult_list.member_name 用户名称
- * @apiSuccess {Int} result.consult_list.store_id 店铺ID
- * @apiSuccess {Int} result.consult_list.store_name 店铺名称
- * @apiSuccess {Object} result.consult_type 咨询类型,键为咨询类型ID
- * @apiSuccess {Int} result.consult_type.consulttype_id 咨询类型ID
- * @apiSuccess {String} result.consult_type.consulttype_introduce 咨询类型描述
- * @apiSuccess {String} result.consult_type.consulttype_name 咨询类型名称
- * @apiSuccess {Int} result.consult_type.consulttype_sort 咨询类型排序
- * @apiSuccess {Int} result.page_total 总页数
- * @apiSuccess {Boolean} result.hasmore 是否有更多 true是false否
- */
- public function index()
- {
- $this->my_consult();
- }
- public function my_consult()
- {
- //实例化商品咨询模型
- $consult_model = model('consult');
- $goods_model = model('goods');
- $search_array = array();
- if (input('param.type') != '') {
- if (input('param.type') == 'to_reply') {
- $search_array[] = array('consult_reply', '=', '');
- }
- if (input('param.type') == 'replied') {
- $search_array[] = array('consult_reply', '<>', '');
- }
- }
- $search_array[] = array('member_id', '=', $this->member_info['member_id']);
- $list_consult = $consult_model->getConsultList($search_array);
- if (!empty($list_consult)) {
- foreach ($list_consult as $key => $val) {
- $condition = array();
- $condition[] = array('goods_id', '=', $val['goods_id']);
- $goodsinfo = $goods_model->getGoodsInfo($condition, 'goods_image,goods_price');
- $list_consult[$key]['goods_image'] = goods_cthumb($goodsinfo['goods_image']);
- $list_consult[$key]['goods_price'] = $goodsinfo['goods_price'];
- }
- }
- // 咨询类型
- $consult_type = rkcache('consulttype', true);
- $result = array_merge(array('consult_list' => $list_consult, 'consult_type' => $consult_type), mobile_page($consult_model->page_info));
- ds_json_encode(10000, '', $result);
- }
- }
|