Example #1
0
 public function add(App_Account_BindDm $dm)
 {
     if (true !== ($r = $dm->beforeAdd())) {
         return $r;
     }
     return $this->_loadDao()->add($dm->getData());
 }
 public function bind($uid, $app_uid, $type)
 {
     $name = $this->_getAccountTypeService()->getTypeName($type);
     if ($this->_getAccountBindDs()->getByAppUidAndType($app_uid, $type)) {
         $msg = '该' . $name . '账号已绑定,不能重复绑定';
         return new PwError($msg);
     }
     if (!$this->_getAccountTypeService()->checkType($type)) {
         return new PwError('绑定类型错误,请重试');
     }
     if ($this->_getAccountBindDs()->getByUidAndType($uid, $type)) {
         return new PwError('请勿重复绑定');
     }
     $dm = new App_Account_BindDm();
     $dm->setUid($uid)->setType($type)->setAppUid($app_uid);
     return $this->_getAccountBindDs()->add($dm);
 }