|
|
@@ -3,6 +3,8 @@ namespace app\admin\controller\auction;
|
|
|
|
|
|
use app\admin\controller\AuthController;
|
|
|
use app\admin\controller\Union;
|
|
|
+use app\models\auction\AuctionTime;
|
|
|
+use app\models\user\User;
|
|
|
use crmeb\services\{ExpressService,
|
|
|
JsonService,
|
|
|
MiniProgramService,
|
|
|
@@ -189,25 +191,47 @@ class AuctionProduct extends AuthController
|
|
|
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 修改商品所属人页面
|
|
|
+ * @param $id
|
|
|
+ * @return string
|
|
|
+ * @throws \Exception
|
|
|
+ */
|
|
|
+ public function belonging($id)
|
|
|
+ {
|
|
|
+ $f = [];
|
|
|
+ $f[] = Form::input('account', '输入用户账号或者ID' );
|
|
|
+ $f[] = Form::hidden('id', $id );
|
|
|
+ $form = Form::make_post_form('修改', $f, Url::buildUrl('belonging_save'));
|
|
|
+ $this->assign(compact('form'));
|
|
|
+ return $this->fetch('public/form-builder');
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改商品所属人
|
|
|
+ * @param $account
|
|
|
+ * @param $id
|
|
|
+ * @return void
|
|
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
+ * @throws \think\db\exception\DbException
|
|
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
+ */
|
|
|
+ public function belonging_save($account, $id)
|
|
|
+ {
|
|
|
+ if (!$account) return Json::fail('不能为空');
|
|
|
+ $user = User::where('account|uid', '=', $account)->find();
|
|
|
+ if (!$user) return Json::fail('用户不存在');
|
|
|
+ $product = \app\admin\model\auction\AuctionProduct::find($id);
|
|
|
+ if ($product['is_admin'] != 1 and $product['is_show'] == 1){
|
|
|
+ AuctionTime::where('product_id', $product['id'])->delete();// 删除上架信息
|
|
|
+ }
|
|
|
+ $product['is_show'] = 0;
|
|
|
+ $product['uid'] = $user['uid'];
|
|
|
+ $res = $product->save();
|
|
|
+ if ($res) return Json::success('修改成功');
|
|
|
+ return Json::fail('修改失败');
|
|
|
+ }
|
|
|
|
|
|
-// public function edit($id)
|
|
|
-// {
|
|
|
-// if (!$id) Json::fail('数据不存在');
|
|
|
-//
|
|
|
-//
|
|
|
-// $list = \app\admin\model\auction\Auction::get($id);
|
|
|
-// if (!$list) Json::fail('数据不存在');
|
|
|
-//
|
|
|
-// $f = array();
|
|
|
-// $f[] = Form::input('id', 'ID', $list->getData('id'))->disabled(1);
|
|
|
-// $f[] = Form::input('nickname', '名称', $list->getData('nickname'));
|
|
|
-// $f[] = Form::uploadImageOne('image', '图片','/index.php/admin/widget.images/upload',$list->getData('image'));
|
|
|
-// $f[] = Form::radio('is_promoter', '推广员',$list->getData('status'))->options([['value' => 1, 'label' => '启用'], ['value' => 0, 'label' => '禁用']]);
|
|
|
-// $f[] = Form::dateTime('time', '推广员',$list->getData('add_time'));
|
|
|
-//
|
|
|
-// $form = Form::make_post_form('添加用户通知', $f, Url::buildUrl('update', array('uid' => $id)), 5);
|
|
|
-// $this->assign(compact('form'));
|
|
|
-// return $this->fetch('public/form-builder');
|
|
|
-// }
|
|
|
|
|
|
}
|