* code for bind dinguserid.
This commit is contained in:
+1
-1
@@ -3,6 +3,6 @@ CREATE TABLE `zt_dinguserid` (
|
||||
`webhook` mediumint(8) unsigned NOT NULL,
|
||||
`account` varchar(30) NOT NULL,
|
||||
`userid` varchar(255) NOT NULL,
|
||||
UNIQUE KEY `webhook_account_userid` (`webhook`,`account`,`userid`)
|
||||
UNIQUE KEY `webhook_account` (`webhook`,`account`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
DROP TABLE IF EXISTS `zt_translation`;
|
||||
|
||||
@@ -11,6 +11,14 @@
|
||||
*/
|
||||
class webhook extends control
|
||||
{
|
||||
/**
|
||||
* Construct
|
||||
*
|
||||
* @param string $moduleName
|
||||
* @param string $methodName
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($moduleName = '', $methodName = '')
|
||||
{
|
||||
parent::__construct($moduleName, $methodName);
|
||||
|
||||
@@ -221,6 +221,8 @@ class webhookModel extends model
|
||||
public function bind($webhookID)
|
||||
{
|
||||
$data = fixer::input('post')->get();
|
||||
|
||||
$this->dao->delete()->from(TABLE_DINGUSERID)->where('account')->in(array_keys($data->userid))->exec();
|
||||
foreach($data->userid as $account => $userid)
|
||||
{
|
||||
if(empty($userid)) continue;
|
||||
@@ -229,7 +231,7 @@ class webhookModel extends model
|
||||
$dingUser->webhook = $webhookID;
|
||||
$dingUser->account = $account;
|
||||
$dingUser->userid = $userid;
|
||||
$this->dao->replace(TABLE_DINGUSERID)->data($dingUser)->exec();
|
||||
$this->dao->insert(TABLE_DINGUSERID)->data($dingUser)->exec();
|
||||
}
|
||||
return !dao::isError();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user