|
|
@@ -8,10 +8,8 @@ use app\common\logic\MyBscApi;
|
|
|
use app\common\controller\Api;
|
|
|
use app\common\model\AnnouncementModel;
|
|
|
use app\common\model\UserCollect;
|
|
|
-use app\common\model\LedgerSmhChangeModel;
|
|
|
use app\common\model\LedgerUsdtChangeModel;
|
|
|
-use app\common\model\OfflineRechargeRecordModel;
|
|
|
-use app\common\model\OfflineWithdrawRecordModel;
|
|
|
+use app\common\model\ProductBuying;
|
|
|
use app\common\model\ParametersModel;
|
|
|
use app\common\model\ProductOrder;
|
|
|
use app\common\model\UserModel;
|
|
|
@@ -43,141 +41,57 @@ class Market extends Api
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
/*
|
|
|
- * 收藏列表
|
|
|
+ * 相关公告
|
|
|
*/
|
|
|
- public function collectList()
|
|
|
+ public function announcement(AnnouncementModel $announcementModel)
|
|
|
{
|
|
|
- //3.更新主表会员上级
|
|
|
- dump('重建网体');
|
|
|
- $parent_id = 100100;
|
|
|
- $user_id = 101134;
|
|
|
- $user = (new UserModel())
|
|
|
- ->fetchSql(false)
|
|
|
- ->where('id', $user_id)
|
|
|
- ->update([
|
|
|
- 'parent_id' => $parent_id
|
|
|
- ]);
|
|
|
- dump($user, true, '更新状态');
|
|
|
- //删除网体
|
|
|
- (new UserPathModel())
|
|
|
- ->where('user_id', $user_id)
|
|
|
- ->delete();
|
|
|
- // 创建网体
|
|
|
- (new UserPathModel())->createPath($user_id, $parent_id);
|
|
|
-
|
|
|
- $user_list = (new UserModel())
|
|
|
- ->where('parent_id', $user_id)
|
|
|
- ->select();
|
|
|
- $i = 0;
|
|
|
- foreach ($user_list as $user){
|
|
|
- //删除网体
|
|
|
- (new UserPathModel())
|
|
|
- ->where('user_id', $user['id'])
|
|
|
- ->delete();
|
|
|
-
|
|
|
- // 创建网体
|
|
|
- (new UserPathModel())->createPath($user['id'], $user['parent_id']);
|
|
|
- $i++;
|
|
|
- }
|
|
|
+ $params = $this->request->post();
|
|
|
+ $validate = \think\Loader::validate('Market');
|
|
|
+ if(!$validate->scene('announcement')->check($params)) $this->error($validate->getError());
|
|
|
+ $announcement = $announcementModel
|
|
|
+ ->where('find_in_set(:id,product_id)',['id'=>$params['product_id']])
|
|
|
+ ->where('status', $announcementModel::Normal)
|
|
|
+ ->where('to_lang', $this->request->getLan())
|
|
|
+ ->order('id desc')
|
|
|
+ ->paginate($this->pageSize);
|
|
|
+ $this->success('ok', $announcement);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //获取产品最大求购价格
|
|
|
+ public function getBuyingMaxPrice(ProductBuying $productBuying)
|
|
|
+ {
|
|
|
+ $params = $this->request->post();
|
|
|
+ $validate = \think\Loader::validate('Market');
|
|
|
+ if(!$validate->scene('announcement')->check($params)) $this->error($validate->getError());
|
|
|
+
|
|
|
+ $this->success('ok', $productBuying::getProductBuyingMaxPrice($params['product_id']));
|
|
|
|
|
|
- halt($i);
|
|
|
}
|
|
|
-
|
|
|
- public function daoru()
|
|
|
+
|
|
|
+ //求购
|
|
|
+ public function buying()
|
|
|
{
|
|
|
- die;
|
|
|
- $daoru_list = Db::table('user_base')
|
|
|
- //->where('is_dao', 1)
|
|
|
- ->select();
|
|
|
- $i = 0;
|
|
|
- $j = 0;
|
|
|
- //重建钱包
|
|
|
- foreach ($daoru_list as $key => $info) {
|
|
|
- $user = (new UserModel())->getByAddress($info['address']);
|
|
|
- if (!empty($user)) { // 已存在
|
|
|
- // 更新总算力和账变
|
|
|
- (new LedgerWalletModel)->changeWalletAccount($user['id'], Asset::POWER, $info['power'], Action::Reversal, 0);
|
|
|
-
|
|
|
- // 更新自己(有效会员时间)和所有上级的信息(有效直推人数和团队总算力)
|
|
|
- (new UserModel())->updateForRental($user['id'], $info['power']);
|
|
|
- $j++;
|
|
|
- continue;
|
|
|
- }
|
|
|
- }
|
|
|
+ $params = $this->request->post();
|
|
|
+ $validate = \think\Loader::validate('Market');
|
|
|
+ if(!$validate->scene('announcement')->check($params)) $this->error($validate->getError());
|
|
|
+
|
|
|
+
|
|
|
|
|
|
- //重建用户
|
|
|
-// foreach ($daoru_list as $key => $info) {
|
|
|
-//
|
|
|
-// $parent_user = (new UserModel())->getByAddress($info['parent_address']);
|
|
|
-// if(empty($parent_user)){
|
|
|
-// dump('没有上级');
|
|
|
-// dump($info);
|
|
|
-// continue;
|
|
|
-// }
|
|
|
-//
|
|
|
-// $user = (new UserModel())->getByAddress($info['address']);
|
|
|
-// if (!empty($user)) { // 已存在
|
|
|
-// dump($info['id'] . ' - ' . $info['address'] . ' - 已存在');
|
|
|
-//
|
|
|
-// $is = Db::table('user')
|
|
|
-// ->where('id', $user['id'])
|
|
|
-// ->update([
|
|
|
-// 'parent_id' => $parent_user['id']
|
|
|
-// ]);
|
|
|
-// $j++;
|
|
|
-// continue;
|
|
|
-// }
|
|
|
-//
|
|
|
-// unset($info['id']);
|
|
|
-// unset($info['parent_address']);
|
|
|
-// unset($info['is_dao']);
|
|
|
-// $info['parent_id'] = $parent_user['id'];
|
|
|
-// // 创建用户
|
|
|
-// $newUserID = (new UserModel())->insertGetId($info);
|
|
|
-// // 创建钱包
|
|
|
-// (new LedgerWalletModel())->insertGetId([
|
|
|
-// 'user_id' => $newUserID,
|
|
|
-// ]);
|
|
|
-//
|
|
|
-// // 创建网体
|
|
|
-// (new UserPathModel())->createPath($newUserID, $parent_user['id']);
|
|
|
-//
|
|
|
-// $i++;
|
|
|
-//
|
|
|
-// }
|
|
|
- dump($i);
|
|
|
- dump($j);
|
|
|
}
|
|
|
|
|
|
- public function updaetWallet()
|
|
|
+
|
|
|
+
|
|
|
+ //求购列表
|
|
|
+ public function buyingList()
|
|
|
{
|
|
|
- $daoru_list = Db::table('ledger_wallet_1')
|
|
|
- ->whereNotNull('address')
|
|
|
- ->select();
|
|
|
- $i = 0;
|
|
|
- foreach ($daoru_list as $key => $info) {
|
|
|
- dump($info);
|
|
|
- $user = (new UserModel())->getByAddress($info['address']);
|
|
|
- if (empty($user)) {
|
|
|
- dump($info['user_id'] . ' - ' . $info['address'] . ' - 不存在');
|
|
|
- continue;
|
|
|
- }
|
|
|
- unset($info['user_id']);
|
|
|
- unset($info['address']);
|
|
|
-
|
|
|
- //更新钱包
|
|
|
- $is_up = (new LedgerWalletModel())
|
|
|
- ->where('user_id', $user['id'])
|
|
|
- ->update($info);
|
|
|
- dump($user['id'] . '更新' . $is_up);
|
|
|
- $i++;
|
|
|
- }
|
|
|
- dump($i);
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 手段向某会员报单算力
|
|
|
* @return void
|