Example #1
0
 public function editShop($id, $data)
 {
     PlatformShopModel::instance()->where(['uid' => $id])->setField("name", $data['shopName']);
     UserModel::instance()->where(['id' => $id])->setField("tel", $data['tel']);
     if ($data['password'] != '') {
         UserModel::instance()->where(['id' => $id])->setField("tel", $data['password']);
     }
 }
 public function save()
 {
     if ($_POST) {
         if (I("post.id")) {
             // 编辑
             PlatformShopModel::instance()->edit($_POST);
         } else {
             // 添加
             PlatformShopModel::instance()->insert($_POST);
         }
     }
     $this->display();
 }
Example #3
0
 public function _initialize()
 {
     if (!UserModel::instance()->isLogin()) {
         // 判断用户是否登录
         $this->redirect("user/login");
     } else {
         $this->user = UserModel::instance();
         $this->user->setUser(session(C("LOGIN_SESSION")));
         if ($this->user->getId() == 1) {
             // 管理员
             layout(false);
             $list = PlatformShopModel::instance()->getList();
             $this->assign("list", $list);
         } else {
             // 店铺用户
             if ($this->user->getShopStatus() == 0) {
                 $this->redirect("user/login", ['error' => 1]);
             }
         }
     }
 }
Example #4
0
 public function setShopStatus()
 {
     $status = I('status');
     PlatformShopModel::instance()->where(['uid' => I('id')])->setField('status', $status);
     $this->ajaxSuccess('设置成功');
 }