Esempio n. 1
0
 /**
  * 父亲菜单Map
  */
 public function ParentsMap()
 {
     $parentMenus = self::findAll(['menu_show' => 1, 'parent_id' => 0]);
     $parentMenus = ArrayHelper::toarray($parentMenus);
     $parentMenus = ArrayHelper::map($parentMenus, 'menu_id', 'menu_name');
     $parentMenus[0] = '父级菜单';
     return $parentMenus;
 }
Esempio n. 2
0
 /**
  * Views help desk issue and its activities.
  *
  * <b>Request Type</b>: GET<br/><br/>
  * <b>Request Endpoint</b>:http://{server-domain}/api/chat/issue/{id}<br/><br/>
  * <b>Content-type</b>: application/json<br/><br/>
  * <b>Summary</b>: This api is used for help desk to view issue and corresponding activities.
  * <br/><br/>
  *
  * <b>Request Params</b>:<br/>
  *     accesstoken: string, the access token<br/>
  *     <br/><br/>
  *
  * <b>Response Params:</b><br/>
  *     return issue detail and its all related activities and attachements, if success,
  *     ortherwise, throw an invalid parameters exception.<br/>
  *     <br/><br/>
  *
  * <b>Request Example:</b><br/>
  * <pre>
  * {
  *     "accesstoken" : "eeaa31a8-1d55-247e-70a2-bc9af23918ec",
  *     "id": "55c446c60faf303f0b8b456a"
  * }
  * </pre>
  * <br/><br/>
  *
  * <b>Response Example</b>:<br/>
  * <pre>
  * {
  *  "issue": {
  *    "id": "55c72d5e0faf308f048b4567",
  *    "title": "测试Function CreateActivity--2",
  *    "description": "如果成功返回结果ok",
  *    "status": "resolved",
  *    "creator": {
  *         "id": "55c446c60faf303f0b8b456a",
  *         "name": "byronzhang",
  *         "email": "*****@*****.**"
  *         "avatar": "http://vincenthou.qiniudn.com/52a82080e78c991bc0ca3d3a.png"
  *         ...
  *    },
  *    "assignee": null,
  *    "createdAt": 1439116638125,
  *    "attachments": [
  *    {
  *        "id": "55cc90d70faf30e21a8b4573",
  *        "name": "195750372",
  *        "type": "image/jpeg",
  *        "size": "0.01",
  *        "url": "http://vincenthou.qiniudn.com/4f8dd288bc5291273c91d43d.jpg",
  *        ...
  *    }],
  *    "activities": [
  *    {
  *      "id": "55c72d5e0faf308f048b4568",
  *      "creator": {
  *         "id": "55c446c60faf303f0b8b456a",
  *         "name": "byronzhang",
  *         "email": "*****@*****.**"
  *         "avatar": "http://vincenthou.qiniudn.com/52a82080e78c991bc0ca3d3a.png"
  *         ...
  *      },
  *      "action": "create",
  *      "description": "测试Function CreateActivity",
  *      "createdAt": 1439116638254
  *    },
  *    {
  *      "id": "55c72e2f0faf3090048b4568",
  *      "creator": {
  *         "id": "55c446c60faf303f0b8b456a",
  *         "name": "byronzhang",
  *         "email": "*****@*****.**"
  *         "avatar": "http://vincenthou.qiniudn.com/52a82080e78c991bc0ca3d3a.png"
  *         ...
  *      },
  *      "action": "claim",
  *      "description": "",
  *      "createdAt": 1439116638254,
  *    }
  *  ]
  *}
  * </pre>
  */
 public function actionView($id)
 {
     $issue = Issue::findByPk($id);
     if (empty($issue)) {
         throw new InvalidParameterException(['issue' => Yii::t('issue', 'issue_id_does_not_exist')]);
     }
     $issue->creator = $issue->creatorDetail;
     $issue->assignee = $issue->assigneeDetail;
     $activities = $issue->activities;
     foreach ($activities as $activity) {
         $activity->creator = $activity->creatorDetail;
     }
     $result = array_merge(ArrayHelper::toarray($issue), ['attachments' => $issue->attachments, 'activities' => $issue->activities]);
     return $result;
 }