1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- <?php
- namespace app\admin\model;
- use think\Db;
- use think\Model;
- class EmailsModel extends Model
- {
- protected $name = 'email';
- public function getByWhere($map,$od, $Nowpage, $limits)
- {
- $res = $this
- ->where($map)
- ->page($Nowpage, $limits)
- ->order($od)
- ->select();
- return $res;
- }
- /**
- * [getOneMenu 根据菜单id获取一条信息]
- * @author
- */
- public function getInfo($id)
- {
- return $this->where('id', $id)->find();
- }
- /*
- * 页面总数
- */
- public function getCount($map){
- return $this->alias('a')
- ->where($map)
- ->count();
- }
- public function edit($param)
- {
- $param['update_time']=time();
- $res=$this->allowField(true)->save($param, ['id' => $param['id']]);
- if($res){
- return ['code' => 200, 'data' => '', 'msg' => '编辑成功'];
- }else{
- return ['code' => 100, 'data' => '', 'msg' =>'编辑失败'];
- }
- }
- public function add($param)
- {
- $param['spread_id']=session('uid');
- $param['create_time']=time();
- $res=$this->allowField(true)->save($param);
- if($res){
- return ['code' => 200, 'data' => '', 'msg' => '添加成功'];
- }else{
- return ['code' => 100, 'data' => '', 'msg' =>'添加失败'];
- }
- }
- /**
- * batchDelUser 批量删除管理员
- * @param $param
- * @return array
- */
- public function del($param){
- try{
- Db::name('email')->where('id','=',$param)->update(['is_deleted'=>time()]);
- return ['code' => 200, 'data' => '', 'msg' => '批量删除主题收件人成功'];
- }catch( \Exception $e){
- return ['code' => 100, 'data' => '', 'msg' => '批量删除主题收件人失败'];
- }
- }
- /**
- * batchDelUser 批量删除管理员
- * @param $param
- * @return array
- */
- public function batchDel($param){
- try{
- Db::name('email_send')->where('theme_id','in',$param)->update(['is_deleted'=>time()]);
- return ['code' => 200, 'data' => '', 'msg' => '批量删除成功'];
- }catch( \Exception $e){
- return ['code' => 100, 'data' => '', 'msg' => '批量删除失败'];
- }
- }
- }
|