123456789101112131415161718192021222324252627 |
- <?php
- namespace User\Lib;
- use Dever;
- class Wechat
- {
- public function getInfo($uid, $system_source = 5, $project_id = 1)
- {
- return Dever::db('user/wechat')->one(array('uid' => $uid, 'project_id' => $project_id, 'system_source' => $system_source));
- }
- public function update($uid, $openid, $system_source = 5, $project_id = 1)
- {
- $info = $this->getInfo($uid, $system_source, $project_id);
- $data['uid'] = $uid;
- $data['openid'] = $openid;
- $data['system_source'] = $system_source;
- $data['project_id'] = $project_id;
- if ($info) {
- $data['where_id'] = $info['id'];
- return Dever::db('user/wechat')->update($data);
- } else {
- return Dever::db('user/wechat')->insert($data);
- }
- }
- }
|