|
|
@@ -45,16 +45,19 @@ class ChatController extends BaseController
|
|
|
|
|
|
switch ($type) {
|
|
|
case 'text':
|
|
|
+ //文字
|
|
|
$content = $post['content'];
|
|
|
$arr['content'] = $content;
|
|
|
break;
|
|
|
case 'img':
|
|
|
+ //图片
|
|
|
$shortUrl = $post['shortUrl'];
|
|
|
$return = business::formatUploadImg($shortUrl);
|
|
|
$arr['url'] = $return['url'];
|
|
|
$arr['smallUrl'] = $return['smallUrl'];
|
|
|
break;
|
|
|
case 'link':
|
|
|
+ //常用链接
|
|
|
$id = $post['id'];
|
|
|
$respond = MerchantService::getCommonUrl($id);
|
|
|
$arr['name'] = $respond['name'];
|
|
|
@@ -62,23 +65,26 @@ class ChatController extends BaseController
|
|
|
$arr['url'] = $respond['url'];
|
|
|
break;
|
|
|
case 'goods':
|
|
|
+ //商品
|
|
|
$id = $post['id'];
|
|
|
- $info = GoodsService::getGoodsInfo($id);dd($info);
|
|
|
+ $info = GoodsService::getGoodsInfo($id);
|
|
|
GoodsService::valid($info, $this->merchantId);
|
|
|
$arr['goodsName'] = $info['goodsName'];
|
|
|
+ $arr['img'] = isset($info['smallImgList'][0]) ? $info['smallImgList'][0] : '';
|
|
|
+ $arr['price'] = isset($info['price']) ? $info['price'] : 300;
|
|
|
break;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
$data[] = $arr;
|
|
|
-
|
|
|
+
|
|
|
//每隔三分钟显示时间
|
|
|
$minute = (int)date("i");
|
|
|
if ($minute % 3 == 0) {
|
|
|
$time = date("i:s");
|
|
|
$data[] = ['type' => 'time', 'time' => $time];
|
|
|
}
|
|
|
-
|
|
|
Gateway::sendToUid($userId, json_encode($data));
|
|
|
+ util::success($data);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|