| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 | 
							- <?php
 
- namespace Account\Lib;
 
- use Dever;
 
- class Log
 
- {
 
-     # 创建钱包日志
 
-     public function create($data)
 
-     {
 
-         if ($data['status'] == 2) {
 
-             $admin = Dever::load('manage/auth.data');
 
-             if ($admin) {
 
-                 $data['audit_admin'] = $admin['id'];
 
-             }
 
-             $data['audit_date'] = time();
 
-         }
 
-         $data['order_num'] = $this->createOrderNum();
 
-         return Dever::db('account/info_log')->insert($data);
 
-     }
 
-     # 生成订单号
 
-     private function createOrderNum()
 
-     {
 
-         $where['order_num'] = Dever::order('A');
 
-         $state = Dever::db('account/info_log')->one($where);
 
-         if (!$state) {
 
-             return $where['order_num'];
 
-         } else {
 
-             return $this->createOrderNum();
 
-         }
 
-     }
 
-     # 获取日志列表
 
-     public function getList($config_id, $info_id)
 
-     {
 
-         $where['config_id'] = $config_id;
 
-         $where['info_id'] = $info_id;
 
-         list($start, $end) = Dever::month();
 
-         if ($start && $end) {
 
-             $where['start'] = $start;
 
-             $where['end'] = $end;
 
-         }
 
-         $data = Dever::db('account/info_log')->getData($where, function(&$info) {
 
-             return $this->info($info);
 
-         });
 
-         return $data;
 
-     }
 
-     # 根据来源获取日志列表
 
-     public function getListBySource($source, $source_id)
 
-     {
 
-         $where['source'] = $source;
 
-         $where['source_id'] = $source_id;
 
-         $data = Dever::db('account/info_log')->select($where, function(&$info) {
 
-             return $this->info($info);
 
-         });
 
-         return $data;
 
-     }
 
-     # 获取日志详情
 
-     public function getInfo($id)
 
-     {
 
-         $data = Dever::db('account/info_log')->find($id);
 
-         $data = $this->info($data);
 
-         return $data;
 
-     }
 
-     # 获取详情
 
-     private function info($info)
 
-     {
 
-         $info['username'] = '无';
 
-         $config = Dever::db('account/config')->find($info['config_id']);
 
-         $project = Dever::db('account/config_project')->find($config['project_id']);
 
-         $source = Dever::db($project['source'])->find($info['uid']);
 
-         if ($source) {
 
-             $info['username'] = $source[$project['source_name']];
 
-         }
 
-         $info['config_name'] = $config['name'];
 
-         $info['status_name'] = $this->status($info['type_id'], $info['status']);
 
-         $info['type_name'] = Dever::load("account/config_type-one#name", $info['type_id']);
 
-         $info['cdate_string'] = date('Y-m-d H:i', $info['cdate']);
 
-         $info['fee'] = Dever::number($info['ycash'] - $info['cash']);
 
-         return $info;
 
-     }
 
-     # 获取状态名称
 
-     public function status($type, $status)
 
-     {
 
-         if ($type == 2) {
 
-             if ($status == 1) {
 
-                 $status_name = '待审核';
 
-             } elseif ($status == 2) {
 
-                 $status_name = '已审核(待发放)';
 
-             } elseif ($status == 3) {
 
-                 $status_name = '已审核(已发放)';
 
-             } else {
 
-                 $status_name = '已作废';
 
-             }
 
-         } elseif ($status == 2) {
 
-             $status_name = '已入账';
 
-         } else {
 
-             $status_name = '待入账';
 
-         }
 
-         return $status_name;
 
-     }
 
- }
 
 
  |