|
|
@@ -4,8 +4,8 @@
|
|
|
namespace app\api\controller;
|
|
|
|
|
|
use app\common\controller\Api;
|
|
|
-use app\common\model\UserModel;
|
|
|
-use app\common\model\UserPathModel;
|
|
|
+use app\common\model\ProductLists;
|
|
|
+use app\common\model\ProductOrder;
|
|
|
use app\common\model\Synthesis as SynthesisModel;
|
|
|
use fast\Action;
|
|
|
use fast\Asset;
|
|
|
@@ -18,58 +18,50 @@ use think\Log;
|
|
|
class Synthesis extends Api
|
|
|
{
|
|
|
|
|
|
+ protected string $lan = '';
|
|
|
+
|
|
|
+ public function _initialize()
|
|
|
+ {
|
|
|
+ parent::_initialize();
|
|
|
+ $this->lan = $this->request->getLan();
|
|
|
+ }
|
|
|
|
|
|
public function list(SynthesisModel $synthesis)
|
|
|
{
|
|
|
$list = $synthesis->alias('a')
|
|
|
->join("product_list b", "a.product_id = b.id", "left")
|
|
|
- ->join("user u", "a.user_id = u.id", "left")
|
|
|
- ->join("products d", "b.type_id = d.id", "left")
|
|
|
- ->join("product_area dr", "dr.id = a.area_id", "left") //地区
|
|
|
- ->field('a.id,'.'b.'.$this->lan.'_name as name,b.thum as img_url,price,u.nickname,d.'.$this->lan.'_title as title,dr.address')
|
|
|
- ->where('a.status', $synthesis::Normal)
|
|
|
- ->where($map)
|
|
|
- ->order($order)
|
|
|
+ ->field('a.id,a.title,a.start_time,a.end_time,b.thum as img_url')
|
|
|
+ ->where('a.status', $synthesis::Normal)->where('a.to_lang', $this->lan)
|
|
|
+ ->order('a.weigh desc')
|
|
|
->paginate($this->pageSize);
|
|
|
- $this->success('', $list);
|
|
|
+ $this->success('', $list);
|
|
|
}
|
|
|
|
|
|
|
|
|
- /*
|
|
|
- * 更新上级
|
|
|
+ /*
|
|
|
+ * 合成详情
|
|
|
*/
|
|
|
- public function change_parent()
|
|
|
+ public function detail(ProductLists $productLists, ProductOrder $productOrder)
|
|
|
{
|
|
|
- //3.更新主表会员上级
|
|
|
- dump('重建网体');
|
|
|
- $user_list = Db::table('user_1')
|
|
|
- ->order('distance')
|
|
|
- ->select();
|
|
|
- $i = 0;
|
|
|
- foreach ($user_list as $user){
|
|
|
- $parent_info = (new UserModel())
|
|
|
- ->where('address', $user['parent_address'])
|
|
|
- ->find();
|
|
|
- if(!empty($parent_info)){
|
|
|
- $is = Db::table('user')
|
|
|
- ->where('id', $user['id'])
|
|
|
- ->update([
|
|
|
- 'parent_id' => $parent_info['id']
|
|
|
- ]);
|
|
|
- //删除网体
|
|
|
- (new UserPathModel())
|
|
|
- ->where('user_id', $user['id'])
|
|
|
- ->delete();
|
|
|
-
|
|
|
- // 创建网体
|
|
|
- (new UserPathModel())->createPath($user['id'], $parent_info['id']);
|
|
|
- $i++;
|
|
|
- } else{
|
|
|
- dump($user['id'] . '--无上级');
|
|
|
- }
|
|
|
+ $id = $this->request->param('id', 0, 'intval');
|
|
|
+ if(empty($id)) $this->error(__("参数有误,无可用产品"));
|
|
|
+ //合成详情
|
|
|
+ $synthesis = SynthesisModel::get($id);
|
|
|
+ if (!empty($synthesis)) {
|
|
|
+ //条件一
|
|
|
+ $lan = $this->request->getLan();
|
|
|
+ $material_one = $productLists->getBySynthesisProduct($synthesis->material_one, $lan);
|
|
|
+ $synthesis->material_one = $productOrder->getByOrderProductNum($material_one, $synthesis->material_one_num, $this->auth->id);
|
|
|
+ //条件二
|
|
|
+ $material_two = $productLists->getBySynthesisProduct($synthesis->material_two, $lan);
|
|
|
+ $synthesis->material_two = $productOrder->getByOrderProductNum($material_two, $synthesis->material_one_num, $this->auth->id);
|
|
|
+ //条件三
|
|
|
+ $material_three = $productLists->getBySynthesisProduct($synthesis->material_three, $lan);
|
|
|
+ $synthesis->material_three = $productOrder->getByOrderProductNum($material_three, $synthesis->material_one_num, $this->auth->id);
|
|
|
}
|
|
|
-
|
|
|
- halt($i);
|
|
|
+ $this->success('', $synthesis);
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
|