12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <?php
- namespace huorisk\model;
- use huorisk\model\common\CommonModel;
- class MemRiskModel extends CommonModel {
- protected $table = 'mp_mem_risk';
-
- public function mem() {
- return $this->hasone('huo\model\member\MemberModel', 'id', 'mem_id')->field(
- 'id,username,nickname,status as status_label,avatar'
- );
- }
-
- public function addData($data) {
- if (empty($data)) {
- return false;
- }
- $_data = $data;
- $_obj = self::create($_data, true);
- if ($_obj) {
- return true;
- }
- return false;
- }
-
- public function updateData($data, $mem_id) {
- $_map['mem_id'] = $mem_id;
- $_rs = self::update($data, $_map, true);
- if (false == $_rs) {
- return false;
- }
- return true;
- }
-
- public function getInfoByMemId($mem_id) {
- $_map = ['mem_id' => $mem_id];
- $_data = $this->where($_map)->find();
- if (is_object($_data)) {
- $_data = $_data->toArray();
- }
- return $_data;
- }
- }
|