Exemplo n.º 1
0
 public function getLeadedDepartments($onlyId = true, $uid = null)
 {
     $uid = $uid || getCurrentUid();
     $model = D("Department");
     $theUser = $this->find($uid);
     //获取用户所在部门的所有子集部门(包含当前部门)
     $tmp = $model->getTree($theUser["department_id"]);
     $leaded = array();
     foreach ($tmp as $dep) {
         if (inExplodeArray($uid, $dep["leader"])) {
             $leaded[] = $dep["id"];
         }
     }
     $departments = array();
     //遍历查询效率问题
     foreach ($leaded as $lead) {
         $departments = array_merge($departments, (array) $model->getTree($lead));
     }
     if (!$onlyId) {
         return $departments;
     }
     return getArrayField($departments);
 }
Exemplo n.º 2
0
 public function checkStockManger($condition)
 {
     return true;
     $stockIn = D("Stockin")->find($this->mainrowId);
     $managers = D("Stock")->where("id=" . $stockIn["stock_id"])->getField("managers");
     return inExplodeArray(getCurrentUid(), $managers);
 }