1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- <?php
- namespace Agent\Lib;
- use Dever;
- # 记录日志
- class Level_log
- {
- # 记录日志
- public function up($mid, $order_id, $old_level, $new_level, $new_sell, $sell, $group_num = 0)
- {
- $data['mid'] = $mid;
- $data['order_id'] = $order_id;
- $data['old_level'] = $old_level;
- $data['new_level'] = $new_level;
- $data['new_sell'] = $new_sell;
- $data['sell'] = $sell;
- $data['group_num'] = $group_num;
- $data['order_num'] = $this->getOrderId();
- if ($order_id && $order_id > 0) {
- $data['type'] = 1;
- } else {
- $admin = Dever::load('manage/auth.info');
- if ($admin) {
- $data['audit_admin'] = $admin['id'];
- $data['type'] = 2;
- }
- }
- $id = Dever::db('agent/member_level_log')->insert($data);
- if ($id) {
- # 升级时查看是否有升级的合同,如果没有需要生成
- }
- return $id;
- }
- /**
- * 生成日志订单号
- *
- * @return mixed
- */
- public function getOrderId()
- {
- $where['order_num'] = Dever::order('L');
- $state = Dever::db('agent/member_level_log')->one($where);
- if (!$state) {
- return $where['order_num'];
- } else {
- return $this->getOrderId();
- }
- }
- }
|