...
|
...
|
@@ -8,13 +8,20 @@ use addons\litestore\model\Litestoreorder; |
|
|
use addons\litestore\model\Wxlitestoregoods;
|
|
|
use addons\third\model\Third;
|
|
|
use app\admin\model\Litestorenews;
|
|
|
use app\api\model\GoodsMsg;
|
|
|
use app\api\model\LitestoreBanner;
|
|
|
use app\api\model\LitestoreGoodsSpec;
|
|
|
use app\api\model\Message;
|
|
|
use app\api\model\StoreComment;
|
|
|
use app\api\model\UserSearch;
|
|
|
use app\api\validate\GoodsValidate;
|
|
|
use app\api\validate\StoreValidate;
|
|
|
use app\common\controller\Api;
|
|
|
use EasyWeChat\Foundation\Application as WXPAY_APP;
|
|
|
use EasyWeChat\Payment\Order as WXPAY_ORDER;
|
|
|
use think\Db;
|
|
|
use think\Exception;
|
|
|
use think\exception\PDOException;
|
|
|
use think\Request;
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -405,6 +412,61 @@ class Goods extends Api |
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 客服留言提交
|
|
|
* @ApiWeigh (35)
|
|
|
*
|
|
|
* @ApiTitle (客服留言提交)
|
|
|
* @ApiSummary (客服留言提交)
|
|
|
* @ApiMethod (POST)
|
|
|
* @ApiRoute (/api/goods/msg)
|
|
|
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
|
|
|
* @ApiParams (name="goods_id", type="integer", required=true, description="商品id")
|
|
|
* @ApiParams (name="content", type="string", required=true, description="内容")
|
|
|
* @ApiParams (name="mobile", type="string", required=true, description="联系方式")
|
|
|
* @ApiReturnParams (name="code", type="integer", required=true, sample="0")
|
|
|
* @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功")
|
|
|
* @ApiReturn ({
|
|
|
'code':'1',
|
|
|
'msg':'返回成功',
|
|
|
"data": {
|
|
|
}
|
|
|
})
|
|
|
*/
|
|
|
public function msg()
|
|
|
{
|
|
|
$param = (new StoreValidate())->goCheck('msg');
|
|
|
$where = [
|
|
|
'where' => [
|
|
|
'id' => $param['goods_id']
|
|
|
]
|
|
|
];
|
|
|
$goods = $this->goods_model->findOrFail($where);
|
|
|
$msg_model = new GoodsMsg();
|
|
|
Db::startTrans();
|
|
|
$result = false;
|
|
|
try{
|
|
|
$add = [
|
|
|
'user_id' => $this->auth->id,
|
|
|
'store_id' => $goods['object_id'],
|
|
|
'content' => $param['content'],
|
|
|
'mobile' => $param['mobile'],
|
|
|
];
|
|
|
$result = $msg_model->add($add);
|
|
|
Db::commit();
|
|
|
} catch (PDOException $e) {
|
|
|
Db::rollback();
|
|
|
$this->error($e->getMessage());
|
|
|
} catch (Exception $e) {
|
|
|
Db::rollback();
|
|
|
$this->error($e->getMessage());
|
|
|
}
|
|
|
if(!$result) {
|
|
|
$this->error('留言失败');
|
|
|
}
|
|
|
$this->success('留言成功');
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 立即购买
|
|
|
* @ApiWeigh (25)
|
|
|
*
|
...
|
...
|
|