Beispiel #1
0
 /**
  * Search member by conditions
  * @param $conditions array
  * @param $page
  * @param $pageSize
  * @author Rex Chen
  */
 public function search($conditions, $page = 1, $pageSize = 20)
 {
     $conditions['tags'] = empty($conditions['tags']) ? '' : implode(',', $conditions['tags']);
     $dataProvider = ModelMember::search($conditions, $this->accountId);
     return $this->formatPageResult($dataProvider, $page, $pageSize);
 }
 /**
  * Query member list
  *
  * <b>Request Type</b>: GET<br/><br/>
  * <b>Request Endpoint</b>:http://{server-domain}/api/member/members<br/><br/>
  * <b>Response Content-type</b>: application/json<br/><br/>
  * <b>Summary</b>: This api is used for querying members by propertities.
  * <br/><br/>
  *
  * <b>Request Params</b>:<br/>
  *     accounts: string, id of the channel accounts = 54aa7876e9c2fbe9038b4571,54aa7876e9c2fbe9038b4571 <br/>
  *     tags: string, tags = asd,abc<br/>
  *     cards: string, tags = 54a38828e9c2fbec038b4589,54a38828e9c2fbec038b4586<br/>
  *     createdAt: timestamp<br/>
  *     gender: male, female<br/>
  *     country: string<br/>
  *     province: string<br/>
  *     city: string<br/>
  *     searchKey: string<br/>
  *     per-page: int<br/>
  *     page: int<br/>
  *     <br/><br/>
  *
  * <b>Response Params:</b><br/>
  *     items: array, json array to queried channels detail information<br/>
  *     _meta: array, the pagination information.
  *     <br/><br/>
  *
  * <br/><br/>
  *
  * <b>Response Example</b>:<br/>
  * {
  *      "items": [
  *          {
  *              "id": "54a8a24de9c2fbe9038b4569",
  *              "card": {
  *                  "id": "54a38828e9c2fbec038b4589",
  *                  "name": "银卡",
  *                  "poster": "http://aaaa",
  *                  "fontColor": "ffff",
  *                  "privilege": "银卡任命",
  *                  "condition": {
  *                      "minScore": 13,
  *                      "maxScore": 15
  *                  },
  *                  "usageGuide": "aaaaaaaaaaaaaaaa",
  *                  "isEnabled": true,
  *                  "isDefault": false,
  *                  "provideCount": 2,
  *                  "$createdAt": "2014-12-31 13:22:48",
  *                  "$updatedAt": "2014-12-31 13:22:48"
  *              },
  *              "createdAt": "2015-01-04 10:15:41",
  *              "socialAccount": {
  *                  "name": "熊猫Baby",
  *                  "type": "SERVICE_AUTH_ACCOUNT"
  *              },
  *              "socialMember": "vincent",
  *              "properties": [
  *                  {
  *                      "id": "549a73c3e9c2fb8d7c8b4511",
  *                      "type": "input",
  *                      "name": "姓名",
  *                      "value": "sara"
  *                  },
  *                  {
  *                      "id": "549a73c3e9c2fb8d7c8b4511",
  *                      "type": "input",
  *                      "name": "asd",
  *                      "value": "qwe"
  *                  }
  *              ],
  *              "avatar": "http://aaa",
  *              "location": null,
  *              "tags": null,
  *              "score": 100,
  *              "remarks": null,
  *              "cardNumber": null
  *          }
  *      ],
  *      "_links": {
  *          "self": {
  *              "href": "http://wm.com/api/member/members?searchKey=a&per-page=1&page=2"
  *          },
  *          "first": {
  *              "href": "http://wm.com/api/member/members?searchKey=a&per-page=1&page=1"
  *          },
  *          "prev": {
  *              "href": "http://wm.com/api/member/members?searchKey=a&per-page=1&page=1"
  *          }
  *      },
  *      "_meta": {
  *          "totalCount": 2,
  *          "pageCount": 2,
  *          "currentPage": 2,
  *          "perPage": 1
  *      }
  *  }
  * <pre>
  * </pre>
  */
 public function actionIndex()
 {
     $params = $this->getQuery();
     $accountId = $this->getAccountId();
     if (!empty($params['cardStates'])) {
         $params['cardExpiredAt'] = Member::getCardExpiredTime($params);
     }
     return Member::search($params, $accountId);
 }