예제 #1
0
 public function on_list()
 {
     $data = parent::on_list(true);
     $actives = D('Home/CompanyActiveApps')->where(['company_id' => get_current_company_id()])->select();
     $actives = get_array_by_field($actives, 'app_id');
     $cleared_list = [];
     $i = 0;
     foreach ($data[1] as $k => $v) {
         // 根据是否启用状态过滤
         if (false !== $this->filter_only_active_status) {
             if ($this->filter_only_active_status > 0 && !in_array($v['id'], $actives)) {
                 continue;
             }
             if ($this->filter_only_active_status < 1 && in_array($v['id'], $actives)) {
                 continue;
             }
         }
         $cleared_list[$i] = $v;
         if (in_array($v['id'], $actives)) {
             $cleared_list[$i]['is_active'] = true;
         } else {
             $cleared_list[$i]['is_active'] = false;
         }
         $i++;
     }
     $data[1] = $cleared_list;
     $this->response($data, 'app', true);
 }
예제 #2
0
 public function on_list()
 {
     $data = parent::on_list(true);
     $actives = D('Home/CompanyActiveApps')->where(['company_id' => get_current_company_id()])->select();
     $actives = get_array_by_field($actives, 'app_id');
     foreach ($data[1] as $k => $v) {
         if (in_array($v['id'], $actives)) {
             $data[1][$k]['is_active'] = true;
         } else {
             $data[1][$k]['is_active'] = false;
         }
     }
     $this->response($data, 'app', true);
 }
예제 #3
0
 public function on_list()
 {
     $data = parent::on_list(true);
     $list = $data[1];
     $product_ids = get_array_by_field($list, 'product_id');
     $map = ['product_id' => ['IN', $product_ids]];
     $total_balance = D('Storage/Stock')->field('SUM(balance) as total_balance, product_id, product_unique_id')->where($map)->group('product_unique_id')->select();
     $total_balance = get_array_to_ka($total_balance, 'product_unique_id');
     foreach ($list as $k => $v) {
         if (array_key_exists($v['product_unique_id'], $total_balance)) {
             $list[$k]['total_balance'] = $total_balance[$v['product_unique_id']]['total_balance'];
         }
     }
     $data[1] = reIndex($list);
     $this->response($data, 'stock', true);
 }
 public function on_list()
 {
     $data = parent::on_list(true);
     switch (I('get._mf')) {
         case "ContactsCompany.id":
             $head_log = D('Crm/CustomerHeadLog', 'Model')->get_by_customer(I('get._mv'), true);
             break;
         case "crm_clue_id":
         default:
             return $this->response($data, 'customer_communicate', true);
     }
     if ($head_log) {
         foreach ($head_log as $k => $v) {
             $head_log[$k]['content'] = __('crm.Customer Head Log Type ' . $v['type']);
         }
         $data = array_merge((array) $data, $head_log);
         // 按时间排序
         $data = multi_array_sort($data, 'created', SORT_DESC);
     }
     return $this->response($data, 'customer_communicate', true);
 }
예제 #5
0
 public function on_list()
 {
     $data = parent::on_list(true);
     $list = $data[1];
     $progress_model = D('Bpm/WorkflowProgress');
     $data[1] = $progress_model->assign_last_progress_to_list($list);
     $this->response($data, D($this->main_model));
 }