|
@@ -6,7 +6,7 @@ use app\api\controller\Product;
|
|
|
use app\common\model\ProductArea;
|
|
use app\common\model\ProductArea;
|
|
|
use app\common\controller\Api;
|
|
use app\common\controller\Api;
|
|
|
use app\common\model\UserWelfare;
|
|
use app\common\model\UserWelfare;
|
|
|
-use app\common\model\ProductPopular;
|
|
|
|
|
|
|
+use app\common\model\ProductLists;
|
|
|
use app\common\model\ProductOrder;
|
|
use app\common\model\ProductOrder;
|
|
|
use app\common\model\UserModel;
|
|
use app\common\model\UserModel;
|
|
|
use think\Loader;
|
|
use think\Loader;
|
|
@@ -28,12 +28,12 @@ class WelfareLoginc
|
|
|
*/
|
|
*/
|
|
|
public static function setUserWelfareLos($uid, int $productId, $num, $tim, $lan, $typeId)
|
|
public static function setUserWelfareLos($uid, int $productId, $num, $tim, $lan, $typeId)
|
|
|
{
|
|
{
|
|
|
- $result = ProductPopular::getPopularByTime($productId, $lan, $tim);
|
|
|
|
|
- if(!$result || $num > ($result->stock-$result->init_num - $result->num)) throw new Exception(__('库存不足'));
|
|
|
|
|
|
|
+ $result = ProductLists::where('id', $productId)->field('id,'.$lan.'_name as name')->find();
|
|
|
|
|
+ //if(!$result || $num > ($result->stock-$result->init_num - $result->num)) throw new Exception(__('库存不足'));
|
|
|
|
|
|
|
|
//添加产品
|
|
//添加产品
|
|
|
- self::setUserProductOrder($num, $result->is_area, $result->id, $result->price, $productId, $uid, $typeId);
|
|
|
|
|
- return ['start_time'=>$tim, 'name'=>$result->name, 'num'=>$num, 'price'=>$result->price];
|
|
|
|
|
|
|
+ self::setUserProductOrder($num, 0, 0, 0, $productId, $uid, $typeId);
|
|
|
|
|
+ return ['start_time'=>$tim, 'name'=>$result->name, 'num'=>$num, 'price'=>0];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|