|
|
@@ -8,8 +8,8 @@ use app\common\model\ProductLists;
|
|
|
use app\common\model\ProductOrder;
|
|
|
use app\common\model\Synthesis as SynthesisModel;
|
|
|
use Exception;
|
|
|
-use fast\Asset;
|
|
|
-use fast\Http;
|
|
|
+use app\api\logic\WelfareLoginc;
|
|
|
+use app\common\model\UserModel;
|
|
|
use think\Db;
|
|
|
use think\Log;
|
|
|
|
|
|
@@ -67,7 +67,7 @@ class Synthesis extends Api
|
|
|
/*
|
|
|
* 合成
|
|
|
*/
|
|
|
- public function create( ProductOrder $productOrder)
|
|
|
+ public function create( ProductOrder $productOrder, UserModel $userModel)
|
|
|
{
|
|
|
$id = $this->request->post('id', 0, 'intval');
|
|
|
$num = $this->request->post('num', 0, 'intval');
|
|
|
@@ -88,8 +88,13 @@ class Synthesis extends Api
|
|
|
$productOrder->setSynthesisOrder($synthesis, $productList, $num, $this->auth->id);
|
|
|
|
|
|
// 添加新订单
|
|
|
- dump( 11);die;
|
|
|
-
|
|
|
+ $result = WelfareLoginc::setUserWelfareLos($this->auth->id, $synthesis->product_id, $num, time(), $this->lan, $productOrder::Synthesi);
|
|
|
+
|
|
|
+ //添加茶数量
|
|
|
+ if($result['price'] > config('min_rwa_price')) $userModel::updateForRwaNum($this->auth->id, $this->auth->parent_id, $num, '+');
|
|
|
+
|
|
|
+ $synthesis->num += $num;
|
|
|
+ $synthesis->save();
|
|
|
// 提交事务
|
|
|
Db::commit();
|
|
|
} catch (Exception $e) {
|