|
|
@@ -178,24 +178,30 @@ class ChatController extends BaseController
|
|
|
{
|
|
|
$post = Yii::$app->request->post();
|
|
|
$key = $post['key'];
|
|
|
- $price = floatval($post['price']);
|
|
|
+ $price = round(floatval($post['price']), 2);
|
|
|
$keyArr = explode('-', $key);
|
|
|
+ if (count($keyArr) != 3) {
|
|
|
+ util::error(-1, '校验失败,key格式错误');
|
|
|
+ }
|
|
|
$shopId = intval($keyArr[0]);
|
|
|
if ($this->shopId != $shopId) {
|
|
|
- util::error(-1, '校验失败,并不是你的客户');
|
|
|
+ util::error(-1, '校验失败,不是你的客户');
|
|
|
}
|
|
|
|
|
|
- $goodsId = $keyArr[2];
|
|
|
- $goods = GoodsClass::getById($goodsId, false, 'id, priceType');
|
|
|
- if ($goods['priceType'] != 0) {
|
|
|
- util::error(-1, '此商品无需走报价');
|
|
|
+ $goodsId = intval($keyArr[2]);
|
|
|
+ $goods = GoodsClass::getById($goodsId, false, 'id, mainId, priceType');
|
|
|
+ // if ($goods['priceType'] != 0) {
|
|
|
+ // util::error(-1, '此商品无需走报价');
|
|
|
+ // }
|
|
|
+ if ($goods['mainId'] != $this->mainId) {
|
|
|
+ util::error(-1, '校验失败,不是你的商品');
|
|
|
}
|
|
|
- $userId = $keyArr[1] ?? 0;
|
|
|
+ $userId = intval($keyArr[1]);
|
|
|
|
|
|
//$currentKey = 'report_price:' . $shopId . '_' . $userId . '_' . $goodsId; // 无价格报价,多处相关,请搜索关键词 shopId_userId_goodsId
|
|
|
$currentKey = ChatClass::getQuotedPriceKey($shopId, $userId, $goodsId);
|
|
|
$val = Yii::$app->redis->executeCommand('GET', [$currentKey]);
|
|
|
- if (!empty($saveAuthCode)) { // 修改报价
|
|
|
+ if (!empty($val)) { // 修改报价
|
|
|
Yii::info('修改报价:' . $currentKey . ' -- 旧价:' . $val . ', 新价:' . $price);
|
|
|
}
|
|
|
|