', ''); } if (intval(input('param.ctid')) > 0) { $where[] = array('consulttype_id', '=', intval(input('param.ctid'))); } $where[] = array('store_id', '=', $this->store_info['store_id']); $list_consult = $consult_model->getConsultList($where, '*', 10); 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); } /** * @api {POST} api/Sellerconsult/drop_consult 商品咨询删除处理 * @apiVersion 1.0.0 * @apiGroup Sellerconsult * * @apiHeader {String} X-DS-KEY 卖家授权token * * @apiParam {Int} id 咨询ID * * @apiSuccess {String} code 返回码,10000为成功 * @apiSuccess {String} message 返回消息 * @apiSuccess {Object} result 返回数据 */ public function drop_consult() { $ids = trim(input('param.id')); if ($ids < 0) { ds_json_encode(10001, lang('param_error')); } $consult_model = model('consult'); $id_array = explode(',', $ids); $where = array(); $where[] = array('store_id', '=', $this->store_info['store_id']); $where[] = array('consult_id', 'in', $id_array); $state = $consult_model->delConsult($where); if ($state) { ds_json_encode(10000, lang('store_consult_drop_success')); } else { ds_json_encode(10001, lang('store_consult_drop_fail')); } } /** * @api {POST} api/Sellerconsult/reply_save 商品咨询回复内容的保存处理 * @apiVersion 1.0.0 * @apiGroup Sellerconsult * * @apiHeader {String} X-DS-KEY 卖家授权token * * @apiParam {Int} consult_id 咨询ID * @apiHeader {String} content 回复内容 * * @apiSuccess {String} code 返回码,10000为成功 * @apiSuccess {String} message 返回消息 * @apiSuccess {Object} result 返回数据 */ public function reply_save() { $consult_id = intval(input('consult_id')); if ($consult_id <= 0) { ds_json_encode(10001, lang('param_error')); } $consult_model = model('consult'); $update = array(); $update['consult_reply'] = input('post.content'); $condition = array(); $condition[] = array('store_id', '=', $this->store_info['store_id']); $condition[] = array('consult_id', '=', $consult_id); $state = $consult_model->editConsult($condition, $update); if ($state) { $consult_info = $consult_model->getConsultInfo(array('consult_id' => $consult_id)); // 发送用户消息 $param = array(); $param['code'] = 'consult_goods_reply'; $param['member_id'] = $consult_info['member_id']; //阿里短信参数 $param['ali_param'] = array( 'goods_name' => $consult_info['goods_name'] ); $param['ten_param'] = array( $consult_info['goods_name'] ); $param['param'] = array_merge($param['ali_param'], array( 'consult_url' => HOME_SITE_URL . '/Memberconsult/my_consult' )); //微信模板消息 $param['weixin_param'] = array( 'url' => config('ds_config.h5_site_url') . '/pages/member/consult/ConsultList', 'data' => array( "keyword1" => array( "value" => $consult_info['consult_id'], "color" => "#333" ), "keyword2" => array( "value" => $consult_info['goods_name'], "color" => "#333" ), "keyword3" => array( "value" => $consult_info['consult_content'], "color" => "#333" ) ), ); model('cron')->addCron(array('cron_exetime' => TIMESTAMP, 'cron_type' => 'sendMemberMsg', 'cron_value' => serialize($param))); ds_json_encode(10000, lang('ds_common_op_succ')); } else { ds_json_encode(10001, lang('ds_common_op_fail')); } } }